package com.chum.chamber.service;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.ExceptionHandler;

import com.chum.chamber.utils.GridBody;
import com.chum.chamber.utils.GridView;

@Service
public class RegisteredCaseServiceImpl implements RegisteredCaseService {

	@Override
	@Transactional
	@ExceptionHandler
	public GridView getRegisteredCaseList() {
		GridView gridView = new GridView();
		GridBody gridBody = new GridBody();
		
		List<String> gridHeader = new ArrayList<String>();
		List<String> gridData = new ArrayList<String>();
		List<GridBody> gridBodies = new ArrayList<GridBody>();
		try {
			//	Grid Header
			gridHeader.add("S.No.");
			gridHeader.add("Case No.");
			gridHeader.add("Case Date");
			//	Grid Body
			gridData.add("1");
			gridData.add("12/20");
			gridData.add("10-Dec-2013");
			
			gridBody.setGridColumn(gridData);
			gridBodies.add(gridBody);
			
			gridData = new ArrayList<String>();
			gridData.add("2");
			gridData.add("11/10");
			gridData.add("12-Dec-2013");
			gridBody = new GridBody();
			gridBody.setGridColumn(gridData);
			gridBodies.add(gridBody);
			
			gridData = new ArrayList<String>();
			gridData.add("3");
			gridData.add("05/01");
			gridData.add("14-Dec-2013");
			gridBody = new GridBody();
			gridBody.setGridColumn(gridData);
			gridBodies.add(gridBody);
			
			gridView.setGridHeader(gridHeader);
			gridView.setGridBody(gridBodies);
			
		} catch (Exception e) {
			e.printStackTrace();
		}
		return gridView;
	}

}
